Skip to content

feat(harness): allow disabling general-purpose subagent - #2354

Open
logicwu0 wants to merge 1 commit into
agentscope-ai:mainfrom
logicwu0:fix/2340-disable-general-purpose-subagent
Open

feat(harness): allow disabling general-purpose subagent#2354
logicwu0 wants to merge 1 commit into
agentscope-ai:mainfrom
logicwu0:fix/2340-disable-general-purpose-subagent

Conversation

@logicwu0

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.0.1-SNAPSHOT

Description

HarnessAgent always registers the built-in general-purpose subagent when subagent support is enabled. This can interfere with explicitly declared subagents by allowing the built-in agent to handle tasks intended for them.

This change adds disableGeneralPurposeSubagent() to disable only the built-in entry while keeping programmatic, workspace-defined, and custom subagents available. Both static and dynamic subagent registration paths honor the new option.

Fixes #2340

Checklist

  • Code has been formatted with mvn spotless:apply
  • All relevant tests are passing
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated
  • Code is ready for review

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@oss-maintainer oss-maintainer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: PR #2354 — feat(harness): allow disabling general-purpose subagent

Verdict: Approved ✅

Adds a disableGeneralPurposeSubagent() builder method that allows users to opt out of the built-in general-purpose subagent while keeping declared and custom subagents available.

Changes:

  • New boolean flag disableGeneralPurposeSubagent in the Builder
  • Conditional registration in buildSubagentEntries() and buildStaticSubagentEntries() — the general-purpose entry is skipped when the flag is set
  • Test coverage verifies the flag works correctly

Useful for users who want to restrict subagent capabilities to only explicitly declared ones, reducing the attack surface and resource usage.

All CI checks pass.

@AgentScopeJavaBot AgentScopeJavaBot added enhancement New feature or request area/harness agentscope-harness (test/runtime support) labels Aug 11, 2026

@AgentScopeJavaBot AgentScopeJavaBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Review

This PR adds a new builder option disableGeneralPurposeSubagent() to HarnessAgent.Builder, allowing users to suppress the built-in "general-purpose" subagent while keeping declared (markdown) and custom (programmatic) subagents available. The change is applied symmetrically to both static and dynamic paths. The change is clean, follows the existing disable*() builder pattern, and has no behavioral impact on existing users.

}

/**
* Disables the built-in {@code general-purpose} subagent while keeping declared and custom

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding a note that this flag has no effect when disableSubagents() is also set, since the entire subagent subsystem is skipped at a higher level.

@AgentScopeJavaBot AgentScopeJavaBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Review

This PR adds a new builder option disableGeneralPurposeSubagent() to HarnessAgent.Builder, allowing users to suppress the built-in "general-purpose" subagent while keeping declared (markdown) and custom (programmatic) subagents available. The change is applied symmetrically to both static and dynamic paths. The change is clean, follows the existing disable*() builder pattern, and has no behavioral impact on existing users.

}

/**
* Disables the built-in {@code general-purpose} subagent while keeping declared and custom

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding a note that this flag has no effect when disableSubagents() is also set, since the entire subagent subsystem is skipped at a higher level.

@AgentScopeJavaBot AgentScopeJavaBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Review

This PR adds a new builder option disableGeneralPurposeSubagent() to HarnessAgent.Builder, allowing users to suppress the built-in "general-purpose" subagent while keeping declared (markdown) and custom (programmatic) subagents available. The change is applied symmetrically to both static and dynamic paths. The change is clean, follows the existing disable*() builder pattern, and has no behavioral impact on existing users.

}

/**
* Disables the built-in {@code general-purpose} subagent while keeping declared and custom

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding a note that this flag has no effect when disableSubagents() is also set, since the entire subagent subsystem is skipped at a higher level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/harness agentscope-harness (test/runtime support) enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: HarnessAgent注入的子agent是自行build出来的HarnessAgent,会默认注入自带的general-purpose

3 participants